<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


app('router')->group([ 'prefix'=> 'admin', 'middleware' => ['web', 'admin'],'namespace'=>'\\App\\Http\\Controllers\\Admin'], function ($router) {

    $router->get('/', 'HomeController@index')->name('admin.home');
//    $router->get('dashboard', 'HomeController@dashboard')->name('admin.dashboard');

    /* @var \Illuminate\Routing\Router $router */
    $router->resource('auth/users', 'UserController')->names('admin.auth.users');
    $router->resource('auth/roles', 'RoleController')->names('admin.auth.roles');
    $router->resource('auth/permissions', 'PermissionController')->names('admin.auth.permissions');
    $router->resource('auth/menu', 'MenuController', ['except' => ['create']])->names('admin.auth.menu');
    $router->resource('auth/logs', 'LogController', ['only' => ['index', 'destroy']])->names('admin.auth.logs');

    $router->post('_handle_form_', 'HandleController@handleForm')->name('admin.handle-form');
    $router->post('_handle_action_', 'HandleController@handleAction')->name('admin.handle-action');

    $router->get('auth/login', 'AuthController@getLogin')->name('admin.login');
    $router->post('auth/login', 'AuthController@postLogin');
    $router->get('auth/logout', 'AuthController@getLogout')->name('admin.logout');
    $router->get('auth/setting', 'AuthController@getSetting')->name('admin.setting');
    $router->put('auth/setting', 'AuthController@putSetting');
});